package cn.com.elite;

import java.io.PrintWriter;
import java.io.StringWriter;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class Util {
	private static final Log log=LogFactory.getLog(Util.class);
	public static String getERRO(Exception e){
		String str="";
		try{
            StringWriter sw=new StringWriter();  
            e.printStackTrace(new PrintWriter(sw,true));  
            str=sw.toString(); 	
		}catch(Exception e1){
			str=e.toString();
			log.error("getERRO:"+e1.toString());
		}
		return str;
	}
	
	public static String getString(Object obj){
		if(obj==null){
			return "";
		}else{
			return obj.toString().replace(" ","");
		}
	}
	  public static String filterForObject(Object Obj) {
		    String str = "";
		    if (Obj == null)
		      str = "";
		    else
		      str = filter(Obj.toString());
		    return str;
		  }
	  public static String filter(String str) {
		    if (str == null)
		      str = "";
		    if (str.equals("null"))
		      str = "";
		    return str.trim();
		  }

}
